
import {defineStore} from 'pinia'
//引入接口
import { reqHospitalInfo,reqHospitalDepartment } from '@/api/hospital';
//引入接口ts类型
import type { hospitalDetailData,hospitalDetail,hospitalDepartmentResponesData } from '@/api/hospital/type';
import type { hospitalDetailState, } from './interface';
const useDetailStore = defineStore('DetailStore',{
    state:():hospitalDetailState=>{
        return {
            hospitalDetail:({} as hospitalDetail),
            hospitalDepartment:[]
        }
    },
    actions:{
        //获取医院详细
        async getHospitalDetail(hoscode:any) {
            let reslut:hospitalDetailData = await reqHospitalInfo(hoscode)
            if(reslut.code == 200) {
                this.hospitalDetail = reslut.data
            }
        },
        //获取医院科室的回调
        async getDepartment(hoscode:string) {
            let reslut:hospitalDepartmentResponesData = await reqHospitalDepartment(hoscode)
           if(reslut.code == 200) {
           this.hospitalDepartment = reslut.data;
           }
            
        }
    },
    getters:{},
})

export default useDetailStore